/**
 * 
 */
package de.gee.erep.client.ui.presenter;

import java.util.ArrayList;

import com.google.gwt.user.client.rpc.AsyncCallback;

import de.gee.erep.client.Environment;
import de.gee.erep.client.calls.rpc.InitializationAsync;
import de.gee.erep.client.ui.displays.CountryDisplay;
import de.gee.erep.shared.entities.country.Country;

/**
 * @author Matthew Gee created: 13.03.2011
 */
public class CountryPresenter extends Presenter<CountryDisplay> {
	/** LaunchKey. */
	public static final String PLACE = "country";
	/**
	 * @param display d
	 * @param env e
	 * @param params p
	 */
	public CountryPresenter(final CountryDisplay display,
			final Environment env, final String params) {
		super(display, env, params);
		setInitialData();
	}
	/**
	 * 
	 */
	private void setInitialData() {
//		super.getDisplay().setData(list)
		InitializationAsync remoteInitService = super.getEnvironment().getModel().getRemoteInitService();
		remoteInitService.getUpdatedCountries(new AsyncCallback<ArrayList<Country>>() {
//		remoteInitService.getCountries(new AsyncCallback<ArrayList<Country>>() {
			
			@Override
			public void onSuccess(final ArrayList<Country> result) {
				CountryPresenter.super.getDisplay().setData(result);
			}
			
			@Override
			public void onFailure(final Throwable caught) {
			}
		});
	}


}
